<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1 id='str'>chenzhifeiGuofeifei</h1>
    <script>


        var str = document.getElementById('str').innerHTML

        var a = str.indexOf('e')
        console.log("e第一次出现的位置为：", a)
        var b = str.lastIndexOf('e')
        console.log("e最后一次出现的位置为：", b)
        var c = str.lastIndexOf('p')
        console.log("p出现的位置为：", c)

        var res = str.slice(0,10);
        console.log("截取姓名：",res)

        var  rstr=str.replace("chenzhifei","baobei")
        console.log("替换姓名：",rstr)

        var  ustr=  str.toUpperCase()
        console.log("变成大写：",ustr)
        var  lstr=  str.toLowerCase()
        console.log("变成小写：",lstr)

        var co=str.concat("拼接的hhh哈哈哈","88","嘿")
        console.log("拼接后：",co)

        var str2="     qwe,ba,df  "
        var tr=str2.trim()
        console.log(str2,"去空格后:",tr)
        var arr1= str2.split(',')
        console.log("逗号分隔后：",arr1)

        let sss="999"
        console.log("转化为数字：",parseInt(sss)+1)//输出1000
    </script>

</body>

</html>